package dataserver.mapper;

import dataserver.pojo.SceneInspection;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import javax.transaction.Transactional;
import java.util.Date;

@Repository
public interface SceneInspectionRepository extends JpaRepository<SceneInspection, Integer>, JpaSpecificationExecutor<SceneInspection> {

    /**
     * 删除根据id
     */
    @Modifying
    @Transactional
    @Query(value = "update SceneInspection data set data.delFlag = 1,data.updateTime=:updateTime,data.updateBy=:updateBy where data.id = :id")
    int deleteByIdFalse(@Param("id") int id, @Param("updateTime") Date updateTime, @Param("updateBy") String updateBy);
}